package conf

import "strings"

var (
	Appid     = "wx447e655075f8a1c4"
	Secret    = "959f02d34c537893211b6982f4ad9eeb"  //微信小程序密钥
	HostPorts = "localhost:8080"
	IsSandBox = "0"
)

const (
	AppIdName     = "appId"
	SecretName    = "secret"
	HostPortsName = "hostPorts"
	IsSandBoxName = "isSandBox"
)

func ParseArgs(args []string) {
	for k, v := range args {
		if k == 0 {
			continue
		}
		arg := strings.Split(v, "=")
		if arg == nil || len(arg) != 2 {
			continue
		}
		switch arg[0] {
		case AppIdName:
			Appid = arg[1]
		case SecretName:
			Secret = arg[1]
		case HostPortsName:
			HostPorts = arg[1]
		case IsSandBoxName:
			IsSandBox = arg[1]
		}
	}
}
